﻿'
' Copyright (c) 2010-2012, MatthiWare
'
' Permission is hereby granted, free of charge, to any person obtaining a
' copy of this software and associated documentation files (the "Software"),
' to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense,
' and/or sell copies of the Software, and to permit persons to whom the
' Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in
' all copies or substantial portions of the Software. 
' You shall include 'MatthiWare' in the credits/about section of the program
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
' FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
'

Imports System.Xml.Serialization
Imports System.Text

<XmlRoot("Config")>
Public Class Cfg

    Public Sub New()
        MyClass.New(0, 0, 0, 0, 0, False)
    End Sub

    Public Sub New(ts As Int32, ww As Int32, wh As Int32, sd As Int32, rcu As Int32, aa As Boolean)
        tileSize = ts
        worldWidth = ww
        worldHeight = wh
        seed = sd
        antiAliasing = aa
        reduceCpuUsage = rcu
    End Sub

    <XmlElement("UseAntiAliasing")>
    Public antiAliasing As Boolean

    <XmlElement("ReducedCpuUsage")>
    Public reduceCpuUsage As Int32

    <XmlElement("TileSize")>
    Public tileSize As Int32

    <XmlElement("WorldWidth")>
    Public worldWidth As Int32

    <XmlElement("WorldHeight")>
    Public worldHeight As Int32

    <XmlElement("Seed")>
    Public seed As Int32

    Public Overrides Function ToString() As String
        Dim sb As New StringBuilder()
        sb.AppendLine("Settings: ")
        sb.AppendLine(String.Format("{0}: {1}", "Anti Aliasing", antiAliasing.ToString()))
        sb.AppendLine(String.Format("{0}: {1}{2}", "Update latency", reduceCpuUsage.ToString(), "ms"))
        sb.AppendLine(String.Format("{0}: {1}", "World Width", worldWidth.ToString()))
        sb.AppendLine(String.Format("{0}: {1}", "World Height", worldHeight.ToString()))
        sb.AppendLine(String.Format("{0}: {1}", "Tile Size", tileSize.ToString()))
        sb.AppendLine(String.Format("{0}: {1}", "Seed", seed.ToString()))
        Return sb.ToString()
    End Function

End Class
